package com.baosight.sczx.zm.ca.service;

import java.util.Calendar;

import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.Utils;
import com.baosight.sczx.zm.ca.domain.VZMCA14;

/**
 * <p>Title: ServiceZMCA14.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 王琪
 * @version 1.0
 * <pre>Histroy:
 *          2011-8-16 上午09:06:42  王琪  Create
 *</pre>
 */
public class ServiceZMCA14  extends ServiceEPBase{

	/**
	 * 初始化
	 * <p>Function: initLoad</p>
	 * <p>Description: </p>
	 * <p>return value: EiInfo</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-8-16 上午09:07:42  王琪
	 * </p>
	 *
	 */
	@Override
	public EiInfo initLoad(EiInfo inInfo) {
		return inInfo;//return this.query(inInfo);
	}

	/**
	 * 全矿当年材料消耗指标
	 * <p>Function: queryByIndex</p>
	 * <p>Description: </p>
	 * <p>return value: EiInfo</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-10-11 上午09:13:42  王琪
	 * </p>
	 *
	 */
	public EiInfo queryByIndex(EiInfo inInfo) {
		VZMCA14 daoBean = new VZMCA14();
		EiInfo outInfo = super.query(inInfo, "ZMCA14.queryByIndex", daoBean);	
		outInfo.addBlock(Utils.generateBlock("chart", daoBean, "ZMCA14.queryIndexByDepartment"));
		return outInfo;
	}
	
	/**
	 * 全矿当月、本年度材料消耗指标
	 * <p>Function: queryGaugeByIndex</p>
	 * <p>Description: </p>
	 * <p>return value: EiInfo</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-10-11 下午14:30:42  王琪
	 * </p>
	 *
	 */
	public EiInfo queryGaugeByIndex(EiInfo inInfo) {
		VZMCA14 daoBean = new VZMCA14();
		EiInfo outInfo = super.query(inInfo, "ZMCA14.queryGaugeByIndex", daoBean);	
	
		return outInfo;
	}	
	
	/**
	 * 全矿当年每月材料消耗
	 * <p>Function: queryByChart</p>
	 * <p>Description: </p>
	 * <p>return value: EiInfo</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-8-16 上午09:15:42  王琪
	 * </p>
	 *
	 */	
	public EiInfo queryByChart(EiInfo inInfo) {
		VZMCA14 daoBean = new VZMCA14();
		inInfo.addBlock(Utils.generateBlock("chart", daoBean, "ZMCA14.queryByChart"));

		Calendar currentTime = Calendar.getInstance(); 
		inInfo.set("month", ""+(currentTime.get(Calendar.MONTH)+1));
		inInfo.set("year", ""+currentTime.get(Calendar.YEAR));
		return inInfo;
	}	

	/**
	 * 全矿当年每月材料计划消耗和实际消耗明细
	 * <p>Function: queryByListView</p>
	 * <p>Description: </p>
	 * <p>return value: EiInfo</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-8-16 上午09:15:42  王琪
	 * </p>
	 *
	 */	
	public EiInfo queryByListView(EiInfo inInfo){
		VZMCA14 daoBean = new VZMCA14();
	
		inInfo.addBlock(Utils.generateOutBlock("departmentPlan", daoBean, inInfo, "ZMCA14.queryByDepartmentPlan", false));
		inInfo.addBlock(Utils.generateOutBlock("departmentActual", daoBean, inInfo, "ZMCA14.queryByDepartmentActual", false));
		inInfo.addBlock(Utils.generateOutBlock("workfacePlan", daoBean, inInfo, "ZMCA14.queryByWorkFacePlan", false));
		inInfo.addBlock(Utils.generateOutBlock("workfaceActual", daoBean, inInfo, "ZMCA14.queryByWorkFaceActual", false));
		inInfo.addBlock(Utils.generateOutBlock("roadwayPlan", daoBean, inInfo, "ZMCA14.queryByRoadWayPlan", false));
		inInfo.addBlock(Utils.generateOutBlock("roadwayActual", daoBean, inInfo, "ZMCA14.queryByRoadWayActual", false));
		inInfo.addBlock(Utils.generateOutBlock("materialTypePlan", daoBean, inInfo, "ZMCA14.queryByMaterialTypePlan", false));
		inInfo.addBlock(Utils.generateOutBlock("materialTypeActual", daoBean, inInfo, "ZMCA14.queryByMaterialTypeActual", false));

		Calendar currentTime = Calendar.getInstance(); 
		inInfo.set("month", ""+(currentTime.get(Calendar.MONTH) + 1));
		inInfo.set("year", ""+currentTime.get(Calendar.YEAR));
		return inInfo;		
	}
	
	
}
